CREATE TABLE [finance].[TxnTypes]
(
[TxnTypeId] [int] NOT NULL IDENTITY(1, 1),
[TxnType] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[TxnDesc] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DRAccountId] [bigint] NOT NULL,
[CRAccountId] [bigint] NOT NULL,
[ActivityTypeId] [int] NOT NULL,
[PayTypeId] [int] NOT NULL,
[StatementNote] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CustomerNote] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Everyone] [bit] NULL,
[Automatic] [bit] NULL,
[Supervisor] [bit] NULL,
[Status] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[UpdatedUser] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[UpdatedDate] [datetime] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [finance].[TxnTypes] ADD CONSTRAINT [PK_TxnTypes] PRIMARY KEY CLUSTERED  ([TxnType], [ActivityTypeId], [PayTypeId]) ON [PRIMARY]
GO
ALTER TABLE [finance].[TxnTypes] ADD CONSTRAINT [FK_TxnTypes_ActivityTypes] FOREIGN KEY ([ActivityTypeId]) REFERENCES [finance].[ActivityTypes] ([ActivityTypeId])
GO
ALTER TABLE [finance].[TxnTypes] ADD CONSTRAINT [FK_TxnTypes_ChartOfAccounts1] FOREIGN KEY ([CRAccountId]) REFERENCES [finance].[ChartOfAccounts] ([ChartOfAccountId])
GO
ALTER TABLE [finance].[TxnTypes] ADD CONSTRAINT [FK_TxnTypes_ChartOfAccounts] FOREIGN KEY ([DRAccountId]) REFERENCES [finance].[ChartOfAccounts] ([ChartOfAccountId])
GO
